package com.derbysoft.lowcostadapter.commons.repository.impl;

import com.derbysoft.lowcostadapter.commons.model.TransactionDetail;
import com.derbysoft.lowcostadapter.commons.model.TransactionLog;
import com.derbysoft.lowcostadapter.commons.repository.TransactionDetailRepository;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by: jason
 * Date: 2012-09-27
 */
@Repository("transactionDetailRepository")
public class TransactionDetailRepositoryImpl extends CommonService<TransactionDetail>
        implements TransactionDetailRepository {
    @Override
    public List<TransactionDetail> find(TransactionLog transactionLog) {
        DetachedCriteria detachedCriteria = DetachedCriteria.forClass(TransactionDetail.class);
        detachedCriteria.add(Restrictions.eq("transactionLog", transactionLog));
        return find(detachedCriteria);
    }
}
